C# 檔案相關應用


檢查檔案位置是否存在

bool isFileExists = File.Exists(@"C:\檔案路徑");//存在為true

瀏覽檔案(檔案名稱)

private void button1_Click(object sender, EventArgs e)
{
    OpenFileDialog openFileDialog = new OpenFileDialog();
    if (openFileDialog.ShowDialog() == DialogResult.OK)
    {
        string templateName = openFileDialog.FileName;
        textBox1.Text = templateName;
    }
}
#C# #Winform







你可能感興趣的文章

ASP.NET Core Web API 入門教學 - 使用PUT更新資料

ASP.NET Core Web API 入門教學 - 使用PUT更新資料

利用 JavaScript 實作簡易 TodoList

利用 JavaScript 實作簡易 TodoList

透過網路交換資料的方式(SOAP 和 RESTful API)

透過網路交換資料的方式(SOAP 和 RESTful API)






留言討論